<template>
	<view class="ad-view" v-if="ad_switch">
		<ad :adpid="adpid" ad-height="200" @load="adOnload" @close="adOnclose" @error="adOnerror"></ad>
	</view>
</template>
<script>
	import {
		mapGetters
	} from 'vuex'
	export default {
		name: "adView",
		computed: {
			...mapGetters(["adpid", "ad_switch"]),
		},
		methods: {
			adOnload() {
				console.log("ad onload")
			},
			adOnclose(e) {
				console.log("ad close", e.detail)
			},
			adOnerror(e) {
				console.log("ad error", e.detail.errCode, " message:: ", e.detail.errMsg)
			},
		}

	}
</script>

<style scoped lang="scss">
	.ad-view {
		width: 100%;
		margin-top: 10rpx;
	}
</style>
